app.service('memberCardService',['$q','utilService',function($q,utilService){

    this.getMemberCard=function($scope){
        var deferred = $q.defer();
        utilService.get({
            url:$scope.app.domain + 'memberCard',
            params:$scope.memberCardVO,
            cache:false
        }).then(function(response){
            deferred.resolve(response.data);
        },function(e){
            console.error(e);
            deferred.reject("连接服务器出错");
        });
        return deferred.promise;
    };

    //删除会员卡
    this.deleteCard=function($scope){
        var deferred = $q.defer();
        utilService.api({
            url:$scope.app.domain + 'memberCard/del',
            data:$scope.cardId,
            method:'PUT'
        }).then(function(result){
            deferred.resolve(result);
        });
        return deferred.promise;
    };

    this.queryMaxCard=function($scope){
        var deferred = $q.defer();
        utilService.get({
            url:$scope.app.domain + 'memberCard/info'
        }).then(function(response){
            deferred.resolve(response.data);
        },function(e){
            console.error(e);
            deferred.reject("连接服务器出错");
        });
        return deferred.promise;
    };

}]);